<?php
$line = array('EventID','ComID','Event','EventDate','Position','FileName','TimeStamp','declaration','flagA','Note','EventDateFormat');
$csv->addRow($line);
foreach ($coevents as $coevent):
    
	$line = array($coevent['Coevent']['EventID'],
	$coevent['Coevent']['ComID'],
	$coevent['Coevent']['Event'],
	$coevent['Coevent']['EventDate'],
	$coevent['Coevent']['Position'],
	$coevent['Coevent']['FileName'],
	$coevent['Coevent']['TimeStamp'],
	$coevent['Coevent']['_declaration'],
	$coevent['Coevent']['_flagA'],
	$coevent['Coevent']['Note'],
	$coevent['Coevent']['EventDateFormat']       
	);
	$csv->addRow($line);
        endforeach;
echo $csv->render("coevents.csv");
?>